<div class="container-fluid">
  <a class='label label-success pull-right' href='/collection/list/' style='margin-right:5px;'>返回列表</a>
  <a class='label label-success pull-right' href='/collection/pick_taobao/?id=<?php echo $collection->id;?>' style='margin-right:5px;'>淘宝客商品</a>
  <a class='label label-success pull-right' href='/collection/edit/?id=<?php echo $collection->id;?>' style='margin-right:5px;'>修改专题信息</a>
  <span class='label label-info'>【<?php echo $collection->name;?>】专题</span>
  <div class='alert alert-info collection' data-collection-id='<?php echo $collection->id;?>' style='background-color:white;'>
    <?php echo $collection->description;?>
  </div>
  <?php if ($collection->products):?>
  <span class='label label-info'>商品列表</span>

    <table class='table  table-striped table-bordered'>
        <thead>
          <tr>
          <th style='width:10%;'>#图片</th>
          <th>#描述</th>
          <th>#图片数量</th>
          <th>
          <?php if (!in_array($sort, array('price_desc', 'price_asc'))):?>
            <a href='<?php echo url('collection/info') . "?id={$collection->id}&sort=price_desc"?>'>#单价</a>
          <?php elseif ($sort == 'price_desc'):?>
            <a href='<?php echo url('collection/info') . "?id={$collection->id}&sort=price_asc"?>'>#单价<i class='icon-chevron-down'></i></a>
          <?php else:?>
            <a href='<?php echo url('collection/info') . "?id={$collection->id}&sort=price_desc"?>'>#单价<i class='icon-chevron-up'></i></a>
          <?php endif;?>
          </th>
          <th>#佣金</th>
          <th>
          <?php if (!in_array($sort, array('commissionRate_asc', 'commissionRate_desc'))):?>
            <a href='<?php echo url('collection/info') . "?id={$collection->id}&sort=commissionRate_desc"?>'>#佣金率</a>
          <?php elseif ($sort == 'commissionRate_desc'):?>
            <a href='<?php echo url('collection/info') . "?id={$collection->id}&sort=commissionRate_asc"?>'>#佣金率<i class='icon-chevron-down'></i></a>
          <?php else:?>
            <a href='<?php echo url('collection/info') . "?id={$collection->id}&sort=commissionRate_desc"?>'>#佣金率<i class='icon-chevron-up'></i></a>
          <?php endif;?>
          </th>
          <th>
          <?php if (!in_array($sort, array('commissionNum_asc', 'commissionNum_desc'))):?>
            <a href='<?php echo url('collection/info') . "?id={$collection->id}&sort=commissionNum_desc"?>'>#30天卖出</a>
          <?php elseif ($sort == 'commissionNum_desc'):?>
            <a href='<?php echo url('collection/info') . "?id={$collection->id}&sort=commissionNum_asc"?>'>#30天卖出<i class='icon-chevron-down'></i></a>
          <?php else:?>
            <a href='<?php echo url('collection/info') . "?id={$collection->id}&sort=commissionNum_desc"?>'>#30天卖出<i class='icon-chevron-up'></i></a>
          <?php endif;?>
          </th>
          <th>
          <?php if (!in_array($sort, array('commissionVolume_asc', 'commissionVolume_desc'))):?>
            <a href='<?php echo url('collection/info') . "?id={$collection->id}&sort=commissionVolume_desc"?>'>#总佣金</a>
          <?php elseif ($sort == 'commissionVolume_desc'):?>
            <a href='<?php echo url('collection/info') . "?id={$collection->id}&sort=commissionVolume_asc"?>'>#总佣金<i class='icon-chevron-down'></i></a>
          <?php else:?>
            <a href='<?php echo url('collection/info') . "?id={$collection->id}&sort=commissionVolume_desc"?>'>#总佣金<i class='icon-chevron-up'></i></a>
          <?php endif;?>
          </th>
          <th style='width:50px;'>#OP</th>
          <th style='width:50px;'>#OP2</th>
          </tr>
        </thead>
        <tbody>
        <?php foreach ($collection->products as $i):?>
          <tr id='product-<?php echo $i->num_iid;?>' >
          <td><?php echo "<a href='{$i->click_url}' target='_blank'><img src='{$i->pic_url}' style='height:76px;' /></a>"?></td>
          <td><p style='font-size:12px;'><?php echo "<a href='{$i->click_url}' target='_blank'>{$i->title}</a>";?></p></td>
          <td><?php echo count($i->imgs());?></td>
          <td><?php echo $i->price;?></td>
          <td><?php echo $i->commission;?></td>
          <td><?php echo floatval($i->commission_rate)/100 . '%';?></td>
          <td><?php echo $i->commission_num;?></td>
          <td><?php echo $i->commission_volume;?></td>
          <td>
            <a class='btn btn-mini btn-success pick' data-toggle="modal" data-num-iid='<?php echo $i->num_iid;?>' data-seller-id='<?php echo $i->seller_id;?>' data-nick='<?php echo $i->nick;?>' data-title='<?php echo $i->title;?>' data-price='<?php echo $i->price;?>' data-item-location='<?php echo $i->item_location;?>' data-seller-credit-score='<?php echo $i->seller_credit_score;?>' data-click-url='<?php echo $i->click_url;?>' data-shop-click-url='<?php echo $i->shop_click_url;?>' data-pic-url='<?php echo $i->pic_url;?>' data-taobaoke-cat-click-url='<?php echo $i->taobaoke_cat_click_url;?>' data-keyword-click-url='<?php echo $i->keyword_click_url;?>' data-coupon-rate='<?php echo $i->coupon_rate;?>' data-coupon-price='<?php echo $i->coupon_price;?>' data-coupon-start-time='<?php echo $i->coupon_start_time;?>' data-coupon-end-time='<?php echo $i->coupon_end_time;?>' data-commission-rate='<?php echo $i->commission_rate;?>' data-commission='<?php echo $i->commission;?>' data-commission-num='<?php echo $i->commission_num;?>' data-commission-volume='<?php echo $i->commission_volume;?>' data-volume='<?php echo $i->volume;?>' data-shop-type='<?php echo $i->shop_type;?>'>推广</a>
          </td>
          <td><a class='btn btn-mini btn-danger delete' data-product-id='<?php echo $i->id;?>'>删除</a></td>
          </tr>
        <?php endforeach;?>
        </tbody>
    </table>
    <div class="pagination pull-right">
      <ul><?php echo $page;?></ul>
    </div>
   <?php endif;?>
</div>
<div class="modal hide fade" id='pick_img' style='width:800px;'>
  <div class="modal-header">
    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
    <h3>选择图片</h3>
    <a class='label label-success' href='javascript:void(0)' id='select_all'>全选</a>
    <a class='label label-success' href='javascript:void(0)' id='unselect_all'>全不选</a>
  </div>
  <div class="modal-body">
  </div>
  <div class="modal-footer">
    <a href="javascript:void(0)" class="btn btn-primary save">保存</a>
  </div>
</div>
<style>
.selected{
border:2px solid green;
}

.unselected{
border:2px solid white;
}
</style>
